/    Sign up×
Community /Pin to ProfileBookmark

Displaying gif file.

I’m on page 237 of the Rhino book, trying to get a gif file to display. The script file, modified from the book, is

<script>
<a href=”Name” img name=”Name” src=”newlogo.gif” width=”637″ height=”132″ border=”0″>
</a>
</script>

The file newlogo.gif is present in the folder. When I execute it, nothing happens.

The error message is
missing = in XML attribute
Test.html (line 2)
<a href=”Name” img name=”Name” src=”newlogo.gif” width=”637″ height=”132″ border=”0″>

What am I missing?

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceJul 11.2006 — This:

<a href="Name" img name="Name" src="newlogo.gif" width="637" height="132" border="0">

</a>

would be more correct as follows:

<a href="[COLOR=Red]URL[/COLOR]" [COLOR=Red]><[/COLOR]img name="Name" src="newlogo.gif" width="637" height="132" border="0">

</a>
Copy linkTweet thisAlerts:
@BobM2222authorJul 11.2006 — I copied your file exactly and ran it. Same non-result. Message is

XML tag name mismatch

Test.html (line 3)

</a>
Copy linkTweet thisAlerts:
@phpnoviceJul 11.2006 — You're getting out of my area, now. This isn't even a JavaScript question. Try this:

<a href="URL" ><img name="Name" src="newlogo.gif" width="637" height="132" border="0" [COLOR=Red][B]/[/B][/COLOR]>

</a>

The space before the red slash is required, too.

[B][COLOR=Blue]EDIT: Wait a minute! I just noticed you have this stuff between SCRIPT tags. That is not correct at all.[/COLOR][/B]
Copy linkTweet thisAlerts:
@BobM2222authorJul 11.2006 — I ran your version. Still no output, but also no error message.

Please tell me what to do about the SCRIPT tags. As you can see, I'm a newbie.

The reason for those tags is that this is going to be part of something much larger in JavaScript. I thought I would tackle the hard part first, and can't seem to get it off the ground.
Copy linkTweet thisAlerts:
@phpnoviceJul 11.2006 — Remove the SCRIPT tags altogether.
Copy linkTweet thisAlerts:
@BobM2222authorJul 11.2006 — Yes, removing the tags brings up the graphics. But I'm trying to create a JavaScript project which will require the tags. That's why I'm on p. 237 of the Rhino book, which uses the tags in its example.
Copy linkTweet thisAlerts:
@phpnoviceJul 11.2006 — Well, can't speak to XHTML or XML -- only to HTML. For an HTML document, the following would work:

<script type="text/javascript">

var str = '<a href="URL"><img name="Name" src="newlogo.gif" width="637" height="132" border="0"></a>';

document.writeln(str);

</script>
Copy linkTweet thisAlerts:
@BobM2222authorJul 11.2006 — Thank you. That worked. I am off and running.
Copy linkTweet thisAlerts:
@phpnoviceJul 11.2006 — You're welcome.

Cheers.
×

Success!

Help @BobM2222 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...