I'm trying to display the below HTML page in Browser. But it shows nothing.
<HTML>
<HEAD>
<TITLE>Code Listing 19-4</TITLE>
<OBJECT ID="Seq1" CLASSID="CLSID:B0A6BAE2-AAF0-11D0-A152-00A0C908DB96">
</OBJECT>
<SCRIPT LANGUAGE="JavaScript">
Seq1.Item("ActionSet1").At(0.000,"showText(`3')",1,0.050,1);
Seq1.Item("ActionSet1").At(1.000,"showText(`2')",1,0.050,1);
Seq1.Item("ActionSet1").At(2.000,"showText(`1')",1,0.050,1);
Seq1.Item("ActionSet1").At(3.000,"showText(`Ta Da!')",1,0.050,1);
function showText(obj){ Span1.innerHTML=obj }
</SCRIPT>
</HEAD>
<BODY onload="Seq1.Item(`ActionSet1').Play()">
<CENTER>
<SPAN ID="Span1" STYLE="font:48pt bold arial;color:red"></SPAN>
</CENTER>
</BODY>
</HTML>
Anyone knows what is the exact issue?
Related
I have a finished JQuery for moving a 360° object (picture) with mouse actions.
The code is working:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery j360 Plugin Demo</title>
<script src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/j360.js" ></script>
</head>
<body>
<div class="jquery-script-clear"></div>
<h1 style="margin-top: 150px;">jQuery j360 Plugin Demo</h1>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#product').j360();
});
</script>
<center>
<div id="product" style="width: 1920px; height: 1080px; overflow: hidden;">
<img src="v/1.png" />
<img src="v/2.png" />
<img src="v/3.png" />
<img src="v/4.png" />
<img src="v/5.png" />
</div>
</center>
</body>
</html>
The needed pictures are received on demand from a server, so I have to create this code on demand after receiving the pictures. I use therefore document.write commands - I know they are not best practice, but usually it works ... Anyway this is the code I use - basically the same (even when I'm debugging I can't find a difference in the created HTML to the "original" HTML)
So basically it's like that:
<button id="click1" onclick="myFunction()">click me</button>
<script>
function myFunction() {
document.writeln('<html>');
document.writeln('<head>');
document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">');
document.writeln('<title>jQuery j360 Plugin Demo</title>');
document.write('<scr');
document.write('ipt src="js/jquery-1.4.4.min.js"></scr');
document.write('ipt>');
document.write('<scr');
document.write('ipt type="text/javascr');
document.write('ipt" src="js/j360.js" ></scr');
document.writeln('ipt>');
document.writeln('</head>');
document.writeln('<body>');
document.writeln('<div class="jquery-script-clear"></div>');
document.write('<scr');
document.writeln('ipt type="text/javascript">');
document.write(' jQuery(document).ready(func');
document.writeln('tion() {');
document.write(" jQuery('");
document.write('#');
document.writeln("product').j360();");
document.writeln(' });');
document.write('</scr');
document.writeln('ipt>');
document.writeln('<center>');
document.writeln('<div id="product" style="width: 960px; height: 540px; overflow: hidden;">');
document.write('<img src="images/01.jpg" />');
document.write('<img src="images/02.jpg" />');
document.write('<img src="images/03.jpg" />');
document.writeln('</div>');
document.writeln('</center>');
document.writeln('</body>');
document.writeln('</html>');
}
</script>
The created HTML shows the picture but the jQuery plugin is not working. The JS are the same.
Thank for your help!
document.write overwrites any code you have.
Example:
function overwrite() {
document.write("Oops, I've overwritten the code!");
}
<!doctype html>
<html>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph</p>
<button onclick="overwrite()">Click me!</button>
</body>
</html>
I've got such simple html.
vkbeatuify.js is located in the same folder.
<html>
<head>
<script type="text/javascript" src="vkbeautify.js"></script>
<script>
var variable = vkbeautify.xml("<root><cat></cat></root>");
document.getElementById('data').innerHTML = variable;
</script>
</head>
<body>
<div id="data">
</div>
</body>
</html>
But when I open page in browser Firefox - it displays nothing.
What is the problem?
I have a problem with the window.opener function (JS):
I created 3 simple pages to simulate my problem:
test.php:
<html>
<head>
</head>
<body>
<input type="button" onclick="window.open('first_page_in_popup.php', 'Popup', 'width=470,height=500');">
<input type="text" id="content" name="content" >
</body>
</html>
first_page_in_popup.php:
<html>
<head>
<script type="text/javascript" >
window.opener.document.getElementById('content').value= "Test from first page in popup";
window.open('second_page_in_popup.php', 'Popup');
</script>
</head>
<body>
</body>
</html>
second_page_in_popup.php:
<html>
<head>
<script type="text/javascript" >
window.opener.document.getElementById('content').value= "Test from second page in popup";
</script>
</head>
<body>
</body>
</html>
Result:
In IE, the input field has the content "Test from second page in popup".
In Chrome and Firefox, the content is : "Test from first page in popup".
The Error Message:
window.opener.document.getElementById(...) is null
try parent.window.opener instead of window.opener
Source: window.opener is null in firefox
I solved the problem by changing the code of page "first_page_in_popup.php" to:
<html>
<head>
<script type="text/javascript" >
window.opener.document.getElementById('content').value= "Test from first page in popup";
window.location.href = 'second_page_in_popup.php';
</script>
</head>
<body>
<p> First Page </p>
<input type="text" id="first" name="first">
</body>
</html>
window.opener.document.getElementById(...) is null
that means content in window.opener.document.getElementById is null or undefined
please try to define
content in second php as defined in first php
hope this will work.
<html>
<head>
<script>
function view_more(pg_no){
alert(pg_no);
}
</script>
</head>
<body>
<span onClick="view_more('1')"></span>
</body>
</html>
Here, I can't understand why it say always
[ReferenceError: view_more is not defined]
I got the same problem today.
My situation was like this:
.html file:
<head>
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="js/functions.js"></script>
</head>
<body>
<div class="lc-form-holder">
<form action="#" method="post">
[...]
<span onclick="myFunction();">NEXT</span>
</form>
</div>
</body>
and .js file:
$(document).ready(function() {
function myFunction() {
console.log('click click');
}
});
When I clicked on <span> I got an error Uncaught ReferenceError: myFuncion is not defined.
But when I do this in .js file (no document.ready):
function myFunction() {
console.log('click click');
}
Everything work just fine.
I don't know is this helpful but I wanna share it if someone check this question in future.
Try this first
<body>
<span onClick="alert('1');"></span>
if the above code works then there must exists others javascript which are actually got error prior to execute your code.
<span onClick="view_more('1')">Test</span>
Add text and then click on text
Working at my end
This is my code --
<html>
<head>
<script>
function view_more(pg_no){
alert(pg_no);
}
</script>
</head>
<body>
<span onClick="view_more('1')">gfgf</span>
</body>
</html>
EDIT
try using this code --
<html>
<head>
<script type="text/javascript">
function view_more(pg_no)
{
alert(pg_no);
}
</script>
</head>
<body>
<span onClick="javascript:view_more('1');">gfgf</span>
</body>
</html>
I'm new to Javascript so please bear with me.
I have code which refreshes the div of the parent window when the child window closes. The problem is when content of the div refreshes it creates a duplicate, and I don't know why. My code is below.
Inside the head tag of the parent I'm doing this:
<html>
<head>
<script language="javascript" type="text/javascript">
function ParentWindowFunction()
{
$(".mydiv").load("Welcome.jsp");
return false;
}
</script>
</head>
<body>
<div class="mydiv">
<img src="<s:property value="#session.img"/>" id="img" width="200" height="150" />
</div>
</body>
</html>
Inside child window's head tag I have:
<html>
<head>
<script type="text/javascript">
function refreshAndClose()
{
window.opener.ParentWindowFunction();
window.close();
}
</script>
</head>
<body onbeforeunload="refreshAndClose();">
...
</body>
</html>
i found solution for my problem instead of refreshing div i am reloading entire page like this
<script>
function winopen()
{
chatterinfo = window.open('fileupload.jsp',"chatterwin","scrollbars=no,resizable=yes, width=400, height=300, location=no, toolbar=no, status=no");
chatterinfo.focus();
}
</script>
<script language="javascript" type="text/javascript">
function ParentWindowFunction()
{
window.location="Login.action?uname=${uname}&&pass=${pass}";
}
</script>
</head>
<body>
<div class="mydiv">
<img src="<s:property value="#session.img"/>" id="img" width="200" height="150" />
</div>
</body>
</html>
Inside child window's head tag I have:
<html>
<head>
<script type="text/javascript">
function refreshAndClose()
{
window.opener.ParentWindowFunction();
window.close();
}
</script>
</head>
<body >
<input type=button onclick="refreshAndClose();" />
</body>
</html>