This method associates unique Ids to desired elements and then CSS Styles can be applied to them!
Test code here (Click)!
appendChild() in use:
document.write() in use:
Keywords:
JavaScript - Apply CSS Style In Scope
JavaScript - Elements Unique Id
- Alcatel (6)
- Android (6)
- Blogger (10)
- Calculators (1)
- Facebook (1)
- Games (4)
- GitHub (1)
- Html-Css-Js (45)
- Illustrator (2)
- InfoSec (13)
- Photoshop (4)
- PHP (11)
- Unicode (2)
- Windows (2)
jQuery
elevateZoom (Requires jQuery)
Microsoft Store (Donation)
Facebook Messenger (Donation)
Many donors of this blog prefer to donate their money through Facebook Messenger!
Click here to go to this blog's Facebook Page!
Thank you!
Click here to go to this blog's Facebook Page!
Thank you!
Request Web\PHP\JavaScript\HTML Project !
Contact us if you want us to develop a Web\PHP\JavaScript\HTML project for you!
Advertise On This Blog!
If you want a Product\Service\Event to be advertised on this blog, feel free to contact us!
Ads (Reserved)
Tuesday, November 20, 2018
Monday, November 19, 2018
JavaScript - Static Variables\Objects For Functions (IIFE Alternative)
Manually associate unique "Global_Static_Objects" to functions alternative! (Click here)
Automatically associate unique "Global_Static_Objects" to functions alternative by pre-editing scripts! (Click here)
Test code here (Click)!
Keywords:
JavaScript - Static Variables\Objects For Functions (IIFE Alternative)
JavaScript - Static Variables For Functions (IIFE Alternative)
JavaScript - Static Objects For Functions (IIFE Alternative)
Sunday, November 18, 2018
JavaScript - String Swap (No Delimiters Required)
This method (click here) requires #@ and #! Delimiters!
The below method does not require delimiters:
Test code here (Click)!
Example1
Example2
Example 3 - using Matched Subpatterns
Keywords:
JavaScript - String Swap (No Delimiter Required)
JavaScript - Word Swap (No Delimiter Required)
JavaScript - Text Swap (No Delimiter Required)
JavaScript - Replace Multiple Strings At Once
The below method does not require delimiters:
Test code here (Click)!
Example1
Example2
Example 3 - using Matched Subpatterns
Keywords:
JavaScript - String Swap (No Delimiter Required)
JavaScript - Word Swap (No Delimiter Required)
JavaScript - Text Swap (No Delimiter Required)
JavaScript - Replace Multiple Strings At Once
Friday, November 16, 2018
JavaScript - Static Objects For Functions
The code below is based on this code (Click for more infos)!
Test code here (Click)!
- Place functions inside the "<textarea>" element!
- Add "@@@_Create_Local_Static_Objects_@@@" inside each function and the code will automatically create a "Static" and "Local" objects for them!
The functions will be Pre-Edited then they will be written to the document (DOM)!
Test code here (Click)!
- Place functions inside the "<textarea>" element!
- Add "@@@_Create_Local_Static_Objects_@@@" inside each function and the code will automatically create a "Static" and "Local" objects for them!
The functions will be Pre-Edited then they will be written to the document (DOM)!
Wednesday, November 14, 2018
JavaScript - Alternative for Functions Static Variables!
This method basically allows you to use "Local" object to store functions local values and "Static" object to store functions static values!
To create the functions "Static" objects, use unique global variable names based on the function name itself such as "Function_Test_Function", "Function_ScreenGet_Function", "Function_Calculate8776_Function", "Class_Function_Test_Class", etc, etc, etc ...!
When a function returns, javascript automatically clears all its "Local" variables values!
If you need a value to be remembered between the function calls, you need to store that value in a "Static" variable of that same function!
Unfortunately, javascript does not support functions "Static" variables! (Most languages that I know support it!)
So, an alternative is:
- lets say your function name is "Test"
- inside the function, create a "global" object based on your function's name, example: "Function_Test_Function"
- inside the function, declare "Static" variable as local object by passing the reference of "Function_Test_Function" object inside it!
- now you can store static values of your function through the local "Static" object, example: Static.x, Static.y, Static.data, etc, etc
note that:
- using "Static.x" or "Function_Test_Function.x" is the same thing, but the former is more practical to use then the latter!
- both "Static" or "Function_Test_Function" variables reference the same object stored in the ram memory!
- "Static" or "Function_Test_Function" variables don't contain the object's values, they contain only a reference to an object stored in the memory!
Keywords:
JavaScript - Alternative for Functions Static Variables!
To create the functions "Static" objects, use unique global variable names based on the function name itself such as "Function_Test_Function", "Function_ScreenGet_Function", "Function_Calculate8776_Function", "Class_Function_Test_Class", etc, etc, etc ...!
When a function returns, javascript automatically clears all its "Local" variables values!
If you need a value to be remembered between the function calls, you need to store that value in a "Static" variable of that same function!
Unfortunately, javascript does not support functions "Static" variables! (Most languages that I know support it!)
So, an alternative is:
- lets say your function name is "Test"
- inside the function, create a "global" object based on your function's name, example: "Function_Test_Function"
- inside the function, declare "Static" variable as local object by passing the reference of "Function_Test_Function" object inside it!
- now you can store static values of your function through the local "Static" object, example: Static.x, Static.y, Static.data, etc, etc
note that:
- using "Static.x" or "Function_Test_Function.x" is the same thing, but the former is more practical to use then the latter!
- both "Static" or "Function_Test_Function" variables reference the same object stored in the ram memory!
- "Static" or "Function_Test_Function" variables don't contain the object's values, they contain only a reference to an object stored in the memory!
Keywords:
JavaScript - Alternative for Functions Static Variables!
Wednesday, September 12, 2018
JavaScript - String Swap (Replace Multiple Strings At Once)
Keywords:
JavaScript - String Swap
JavaScript -Replace Multiple Strings At Once
Monday, February 26, 2018
JavaScript - Non-RegEx String Replace Function
This is a Non-RegEx String Replace Function!
All RegEx special characters from "Match" and "Replace" parameters are automatically escaped!
Some people alerted me that v1.0 is not compatible with Internet Explorer, so I decided to release v1.1!
(v1.0 is not compatible because Internet Explorer does not support functions default parameters values!)
v1.1 (Compatible with Internet Explorer)
v1.0 (Not compatible with Internet Explorer)
Keywords:
JavaScript - Non-RegEx String Replace Function
JavaScript - Non-RegEx StringReplace() Function
JavaScript - Non-RegEx StringReplace(Function)
All RegEx special characters from "Match" and "Replace" parameters are automatically escaped!
Some people alerted me that v1.0 is not compatible with Internet Explorer, so I decided to release v1.1!
(v1.0 is not compatible because Internet Explorer does not support functions default parameters values!)
v1.1 (Compatible with Internet Explorer)
v1.0 (Not compatible with Internet Explorer)
Keywords:
JavaScript - Non-RegEx String Replace Function
JavaScript - Non-RegEx StringReplace() Function
JavaScript - Non-RegEx StringReplace(Function)
Thursday, February 15, 2018
PHP\JavaScript - 1 Layout for Several Pages (Basic)
"index.html" contains the layout! (Download All Files)
- Url "Folder-Path/index.html" loads "Home.html"
- Url "Folder-Path/index.html?Page=About.html" loads "About.html"
- Url "Folder-Path/index.html?Page=Contact.html" loads "Contact.html"
- Url "Folder-Path/index.html?Page=DontExist.html" returns "Page does not exist or could not be loaded!"
Everything works great, the only problem is that:
- The website will depend on JavaScript (JavaScript must be enabled!)
- If JavaScript is not enabled, the website warns user that JavaScript must be enabled!
- Deprecated "Synchronous XMLHttpRequest" is in use (Script only continues after server response)
index.html = layout (JavaScript Ajax Get + Url parameters Values)
Layout
Home.html
About.html
Contact.html
________________ Old approach below ________________
(PHP - Notes): Your server or web hosting provider must support PHP scripts in order to work!
layout.html
Windows Portable Apps
index.php (PHP + JavaScript)
index.php (PHP only)
Windows Portable Apps","Home ",$layout);
$content1 = '
index.html (JavaScript only - Ajax Get)
index.html (JavaScript only - jQuery)
Keywords:
PHP\JavaScript - 1 Layout for Several Pages (Basic)
- Url "Folder-Path/index.html" loads "Home.html"
- Url "Folder-Path/index.html?Page=About.html" loads "About.html"
- Url "Folder-Path/index.html?Page=Contact.html" loads "Contact.html"
- Url "Folder-Path/index.html?Page=DontExist.html" returns "Page does not exist or could not be loaded!"
Everything works great, the only problem is that:
- The website will depend on JavaScript (JavaScript must be enabled!)
- If JavaScript is not enabled, the website warns user that JavaScript must be enabled!
- Deprecated "Synchronous XMLHttpRequest" is in use (Script only continues after server response)
index.html = layout (JavaScript Ajax Get + Url parameters Values)
Testing 1 Layout for all Pages
Home About Contact Don't Exist Page 1 2This website requires JavaScript in your Browser to be enabled (Please, enable JavaScript!)!
Home.html
Home Page
Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home Home
About.html
About Page
About About About About About About About About About About About About About About About About About About About About About
Contact.html
Contact Page
Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact Contact
________________ Old approach below ________________
(PHP - Notes): Your server or web hosting provider must support PHP scripts in order to work!
layout.html
Start ...!
End ...!
index.php (PHP + JavaScript)
index.php (PHP only)
This is Home Page
Home page Content
';
$layout = str_replace("",$content1,$layout);
echo $layout;
?>
index.html (JavaScript only - Ajax Get)
index.html (JavaScript only - jQuery)
Keywords:
PHP\JavaScript - 1 Layout for Several Pages (Basic)
Subscribe to:
Posts (Atom)