Jump to content

Videogamer555

Members
  • Posts

    17
  • Joined

  • Last visited

Videogamer555's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. And by the way, forum admin, fix your forum software, so that it doesn't keep wrecking the code I try to post. It took out an important line of code in my OP post, when just having the code the regular part of the post text. And it completely disappeared when it was placed inside CODE tags.
  2. Also useful for copyprotection, if for example you you are linking to a resource you don't want to have individules to find out the URL of (to prevent them from stealing it). More often than for hyperlinks, it's used with embedded content (like EMBED, IMG, or OBJECT tags), or in combination with more complex schemess of displaying copyprotected media, in order to make it difficult to directly get the URL. This will force anybody who wants to rip your content from your site to have to go through the ordeal of trying to de-obfuscate the URL.
  3. This would be great for preventing bots from stealing your links by stealing the HTML code alone (and also keeping the prying eyes of reverse-engineers from figuring out how the links worked, unless they put in considerable effort to de-obfuscate all the vars). Why does this forum keep preventing me from posting this code? Every time I post it, it disappears from the code box! Maybe I'll try it without the code box this time. <html><head><title>index</title><script type="text/javascript">var x = 'http';var a;var b = 'www';var c = '.';var d = 'amazon';var e = c;var f = 'com';function z(g,h,i) {window.location.href=(a + b + g + h + i);}</script></head><body>This is <a href="#" onclick="a=x+y; z(c,d+e,f); return false;">a</a> test.</body></html> Ok, I see, it doesn't like the line that creates the y var. What's going on here? Your forum software appears to be buggy as heck.
  4. If they do not return a value, do they still need a "return" statement to be officially correct? For example: function MyFunc(){some code that does somethingreturn true;} Is this required by the JavaScript standard, or not?
  5. What if I want to create a function without a returned value (something that is self contained, rather than generating a value for use in other JScript code)? For example if I have "document.write('test.')" as my the code for my function, its output will be writing this text directly to the browser window. Do I need to have a Return statement just to make it "officially correct"? Or can I leave out the Return statement when the function does not return a value? Currently my code is: <html><head><title>index</title><script type="text/javascript">function testfunc() {document.open();document.write('test');document.close();}</script></head><body>This is <span onclick="testfunc();">a</span> test.</body></html> I need to know if I need a "return;" after my "document.close();".
  6. Ok, I figured that out finally. This is the code I've got now. <html><head><title>index</title><style>* {position:relative; z-index:-1;}.NotProtected {position:relative; z-index:1;}</style></head><body><div style="position:fixed; left:0px; top:0px; width:100%; height:100%; background-color:rgba(0,0,0,0); z-index:0;"></div><pre>ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ</pre>This is a link to the <a class="NotProtected" href="http://www.ebay.com">Ebay</a> website.<pre>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre></body></html> It works now. However, the level of protection isn't quite as good as I expected (though some of this may be browser-dependent). Doubleclicking will always the first line of text (not sure why). Ctrl+A will still select everything. Getting your cursor to the right of the hyperlink and then selecting the hyperlink with click+drag as you bring your cursor across the hyperlink, will select the link and all the text up to that link. Not very good copyprotection. Too bad there's no way to simply mark a section of a webpage as completely unselectable and unclickable (to prevent unauthorized copying and saving of text and images).
  7. Ok, but isn't position already implicitly used? I mean position:static is the default, meaning that not using the position style element at all is actually equivalent to explicity typing position:static. Isn't that correct?
  8. Here's the code (note that it has been truncated because there were hundreds of lines of copy/pasted "A"s and "Z"s in the original code, that I had to make it scrollable to simulate a large webpage) <html><head><title>index</title><style>a {z-index:1;}pre {z-index:-1;}</style></head><body><div style="position:fixed; left:0px; top:0px; width:100%; height:100%; background-color:rgba(0,0,0,0); z-index:0;"></div><pre>ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ</pre><a href="http://www.ebay.com">Ebay</a><pre>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre></body></html> Here's what it's supposed to do:The transparent DIV that covers the whole screen has a z-index of 0 so it should cover the PRE tags (which have a z-index of -1, and all their text content, making it unclickable, enforcing a copyprotection on it). At the same time, the A tags are set to have a z-index of 1, so they are above the transparent DIV, so they should remain clickable.Here's what's actually happening:Everything, INCLUDING THE HYPERLINK, is unclickable.What I want to know is why is it doing this, instead of what it SHOULD to be doing?
  9. Or do you need a closing tag? Firefox works with it either way, without any glitches, but is it officially correct to use self closing tags? Also is there officially any difference in an IFrame tag's ability to be self closing between HTML4 and HTML5?
  10. All 4 of the below pieces of code have the same linking affect, with no differences that I can see (I'm using the latest version of Firefox as my browser), but one of them must be the "correct" technique. <img src="mypic.jpg" onclick="document.location='http://www.google.com'" /> <img src="mypic.jpg" onclick="window.location='http://www.google.com'" /> <img src="mypic.jpg" onclick="self.location='http://www.google.com'" /> <img src="mypic.jpg" onclick="location='http://www.google.com'" /> Which one is the official correct techniuqe for using JS for turning a part of a web page (such as an image) into a link?
  11. How do I make it suppress the action of the href attribute in a link? If I want a link to depend on the JS in the onclick event, and want it to ignore the href attribute, how do I do this?
  12. ... versus the "body" of the HTML document? Can someone explain that?
  13. Often times I see a block of JS code like this: <script type="text/javascript"><!--some JS codegoes here//--></script> Since it already has the script tags to define the starting and stoping places of the JS code, are the <!-- and the //--> tags really neccesary? Why doesn't it just get written like this?: <script type="text/javascript">some JS codegoes here</script> On another note, do the <script> tags always have to be in the <head> section of the HTML document? Or can they also be in the <body> section? Or are they used in different sections based on specific needs of how specific parts of teh JS code it will be "activated"?
  14. Is there any good reason to use events then, such as "onclick"?
×
×
  • Create New...