Image replacement help
|
|
Could someone please tell me how I can replace the "Google Labs Suggest" image on http://www.google.com/search?hl=.....&complete=1 |
|
|
I meant replace the image with one of my own |
|
|
Are you not seeing an image tag there? Because on the main Google page they use a background image which can be changed with a style sheet or Stylish, on that page I see regular image tag and I'd assume you would know how to change that? Maybe it's different for you because you are logged in. Or are you asking how to use a Data URI ? |
|
|
I realize that it's possible but I'm fairly new to javascript. That's why I need help |
|
|
And I know how to use Data Uri's and I know how to do it with Stylish. More precisely I would like to change image source to one of my. |
|
|
Wouldn't something along the lines of the following work... document.images[0].src = "http://whatever/yourImage.jpg"; |
|
|
There are a number of ways, the above being the simplist. The most direct way I think is with Xpath. We know the name of the image is "logo_google_suggest_sm.gif" so we can replace that directly...
document.evaluate("//img[@src='logo_google_suggest_sm.gif']", document, null, 9, null).singleNodeValue.src = "http://whatever/yourImage.jpg";
However if they change the image name you'll want something more flexible. You could also match A background image would need to be changed via CSS. |
|
|
I used
Now how would I go about changing the height and width. I tried using css and it just doesn't seem to wanna work |
|
|
Nvm I fixed it. I had a typo in the code. Thank you both for your help. I was practically pulling my hair out in frustration. |
