Hi,

i have script ,and i want to useit inside iframe ,does any one know how.

for eg:<i frame src=""></iframe>
is the normal way to use iframe. i wantto know cani use a script inside iframe.

Recommended Answers

All 3 Replies

just use <iframe src="yourscriptfile.php"></iframe>
(If you want to use PHP). then your script needs to write html.

i want to use a javascript file ,can i use it in the same way

Your source file for the iframe (e.g. html or php) can include javascript and css as well as html.
Note the following:
If you want to address elements from the page that contains your iframe use this syntax for example to scroll the iframe itself: parent.your_iframe_name.scrollTo(300,0);
If you want to call a javascript function in the parent page from javascript in the iframe use this syntax for example: onclick="parent.clickNewImage(22);"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.