/    Sign up×
Community /Pin to ProfileBookmark

Calling a Javascript function

Is there a way to call a javascript function in an external javascript file (.js) from an item in an XML RSS Feed document?

to post a comment

2 Comments(s)

Copy linkTweet thisAlerts:
@ibechaneAug 21.2008 — Since the browser needs to be directed to call the script and function, I think the only way to do it is a server-side insertion of an XML node containing the code. Then, your XML could look something like:

[CODE]
<myXML>
<javascript><![CDATA[
<script language="javascript" src="external.js"></script>
<script language="javascript">myFunction();</script>
]]></javascript>
</myXML>[/CODE]


[code=php]
<?php
$data = simplexml_load_file("myXML.xml");
?>
<html>
<head>
<?php echo $data->javascript; ?>
</head>
<body></body>
</html>
[/code]


Does that help? I'm not entirely sure I understood your question.
Copy linkTweet thisAlerts:
@nbcrockettauthorAug 21.2008 — I've found out in my research that some rss aggregators strip out some html elements. I'm specifically talking about the script tag and the onclick event. Is there anyway around this? An example of an aggregator that does this is IE7.
×

Success!

Help @nbcrockett 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.19,
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,
)...