Why will my javascript code not work?

  • 1
  • Question
  • Updated 7 years ago
  • Answered
I am a complete web design novice. I would like to insert a photography album I created using a program called "simple viewer". When finished it gives you an html/java code to insert into your website. Which looks like this:

<!--START SIMPLEVIEWER EMBED.-->


<!-- END SIMPLEVIEWER EMBED -->

I tried copy&pasting this with the html widget. It comes up with the message "there has been an error with your pasted java code". I really have no idea what to do to fix this.

Any help hugley appreciated!?
Photo of Tom Coleman

Tom Coleman

  • 4 Posts
  • 0 Reply Likes
  • not really sure what I'm doing

Posted 7 years ago

  • 1
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
Hello Tom,

Would you mind wrapping the code in <!-- and --> so that we can see it in the post?

It should look like this:

<!--
code
-->
Photo of Kevin

Kevin

  • 475 Posts
  • 29 Reply Likes
Sorry Tom, i couldn't do it either here on my side.
And Marjie, just download simpleviewer to get the code.
I uploaded all files, scripts, swfs, and others, but it just won't work.
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
It could be that the path's to the uploaded files are not correct - if we can see the code, that can help. It also depends on their instructions, for example, if they require code to be added to the Head of the page, it might not work as we do not give access to this area in the Sitebuilder.
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
You know you guys can view the page source to see the code if you find it. Use the search feature and search for "<!--START SIMPLEVIEWER EMBED.-->" and it will bring you right to the code.

Hope this helps.
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
I just found the code, and this is the code:

<!--START SIMPLEVIEWER EMBED.-->
<div></div>
<br />
<!-- END SIMPLEVIEWER EMBED -->

Thats not really a code though. Just a div and a line break. Tom, are you sure this is the code they gave you? Is there anything else that you forgot to copy?

I viewed the page source to get this code, heres a screen shot of that:

Photo of Tom Coleman

Tom Coleman

  • 4 Posts
  • 0 Reply Likes
Thanks for all getting back so quickly.

The code given to me looks like this:

<!--START SIMPLEVIEWER EMBED.-->
<!script type="text/javascript" src="svcore/js/simpleviewer.js">
<!script type="text/javascript">
jQuery(document).ready(function () {
SV.simpleviewer.load("sv-container", "100%", "100%", "000000", true );
});
<!/script>
<!div id="sv-container">
END SIMPLEVIEWER EMBED >

For embedding images, you have to use- "src=resources/__.jpg" do I need to save anything into the file manager to be able to insert the photo gallery? At the moment the source in the code is "svcore/js/simpleviewer.js" would I need to change this, and if so to what?

Thanks again :)
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
Hi Tom, you will need to host that JavaScript some where else,unless you have Yola Silver. If you have Yola Silver let me know. If you have Yola Free, then upload the file they told you to download to http://yourjavascript.com And then they will email you a code. Copy that code and replace the current <script type="text/javascript" src="svcore/js/simpleviewer.js"> tag with the new one they gave you, but keep that second <script>...</script> script and this should work. I used to host my JavaScript on there all the time before I got Yola Silver.

If you need any help with this or if they did not give you a file to download, let me know. Also, what is the website's URL that you got the code from? Is it www.simpleviewer.net?

I hope this helps.

Nathan
Photo of Tom Coleman

Tom Coleman

  • 4 Posts
  • 0 Reply Likes
That's a huge help, thank you!
I'll give it a go, if not I'll get back to you in a bit.
I have yola free. It is www.simpleviewer.net but, you have to download a program, to build the gallery- then that program gives you the code.
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
I am glad it helped! :) Also, thanks for letting me know that a program gives the code to you. Its not that simple since they make you do this JavaScript! They need to make it easier for you. I mean I know ho w to do it but people that don't know HTML and JavaScript, it's hard.

Sincerely,
Nathan
Photo of Tom Coleman

Tom Coleman

  • 4 Posts
  • 0 Reply Likes
I tried using http://yourjavascript.com but after finding the files and clicking "upload" the screen just freezes (like internet explorer would when not responding".

The program saves two files, one XML document and one HTML document. When you click on the HTML document, it just opens the photo gallery as a webpage (from my desktop).

Which file should I be attempting to upload though? Should it be saved as a javascript file?
Photo of Nathan

Nathan, Champion

  • 3739 Posts
  • 307 Reply Likes
You just need the JavaScript file. It ends in .js It does freeze. It is how they set it up. But if you see it under the white screen faded out, it says "Your file has been uploaded..." and other stuff like that. Check your email, they should have sent you the info. If it did not go in your inbox check your spam or junk folder.
Photo of Nazlie

Nazlie

  • 1721 Posts
  • 51 Reply Likes
Hi Tom

I searched for an example of the simple viewer embed code here.

The example given looks like this:

<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player.
<a href="http://www.macromedia.com/go/getflash... Flash.</a></div>
<script type="text/javascript">
var fo = new SWFObject("viewer.swf", "viewer", "800", "600", "8", "#181818");
fo.write("flashcontent");
</script>

If you are getting an error message, please make sure that your have added the filepath of the swfobject.js correctly. Do you know where this is located?

Thanks
Nazlie