Change website Logo image --- light open e-commerce system (enterprise entry level B2C website), logob2c
A total of 2 files:
- Display and upload files: site/links/img_logo.html
- Save the image file: site/links/img_logo_up1.chtml
InLight open e-commerce system (enterprise entry level B2C website)Under the site/links/directory
Display and upload files: site/links/img_logo.html
Show Logo image
Submit the form for uploading a file (Submit to img_logo_up1.chtml
)
<form id=save action="@{sys:face}site/links/img_logo_up1.chtml" onsubmit="return false;" target=_self method=post enctype="multipart/form-data">...</form>
Select image input (note image width and height)
<Tr> <td> <font class = actTitle> New IMAGE </font> </td> <INPUT name = IMAGE size = 32 type = file> (283px * 51px) </td> </tr>
JS functions submitted for verification
Var save = document. forms ['save']; doSubmit = function () {var str = save ['image']. value. toLowerCase (); if (str! = "") {Str = str. substring (str. length-4); if (str! '.Jpg ') {alert ("jpg images only"); return ;}} else {alert ("images must be uploaded! "); Return;} save. submit ();}
Save operation
<If x = "@ {sys: canDo}"> <div align = right x = true> <a href = "javascript: doSubmit ()" title = "Save the new image! "> [Save] </a> </div> </if>
Effect
All code
<Html> <title> change static image </title> <link href = "@ {sys: path} base/css/system.css "rel =" stylesheet "type =" text/css "> <BODY leftMargin =" 0 "topMargin =" 0 "scroll =" no "MARGINWIDTH = "0" MARGINHEIGHT = "0"> <LINK href = "@ {sys: path} base/css/main.css "type =" TEXT/CSS "rel =" STYLESHEET "> <TABLE cellSpacing = 0 cellPadding = 0 width =" 100% "border = 0> <TR vAlign = top> <TD style = "BACKGROUND-REPEAT: repeat-x "background =" @ {sys: path} images/T Itle2.gif "> <TABLE cellSpacing = 0 cellPadding = 0 width =" 100% "border = 0> <TR vAlign = top> <TD height = 32 style =" BACKGROUND-REPEAT: no-repeat "noWrap width =" 100% "class =" GAP1 "> <P style =" MARGIN-LEFT: 2px; MARGIN-RIGHT: 3px "> for static images </P> </TD> </TR> </TABLE> </TD> <TD width = 10 class = "GAP1"> </TD> <chtml> <Bag id = sys> <we name = NodeID> a0 </we> </Bag> <! -- Topic node --> </chtml> <chtml file = "base/ac/checkAcl.htm"/> <! -- Introduce the permission check file --> <TD style = "BACKGROUND-REPEAT: repeat-x" vAlign = bottom width = "100%" background = "@ {sys: path} images/Title4.gif "> <chtml> <if x =" @ {sys: canDo} "> <div align = right x = true> <a href =" javascript: doSubmit () "title =" Save New image! "> [Save] </a> </div> </if> </chtml> </TD> </TR> </TABLE> <table width = 99% align = center border = 1 cellpadding = "3" cellspacing = "0" style = "border-collapse: collapse; font-size: 12px "> <tr> <th colspan = 2>. <font class = listTitle> Logo </font>. </th> </tr> <form id = save action = "@ {sys: face} site/links/img_logo_up1.chtml" onsubmit = "return false; "target = _ self method = post enctype =" multipart/form-data "> <input type = hidden name = reU Rl value = "site/links/img_logo.html"> <tr> <td colspan = 2 align = center> </td> </tr> <td> <font class = actTitle> New Image </font> </td> <INPUT name = IMAGE size = 32 type = file> (283px × 51px) </td> </tr> </form> </table> </BODY>
Save the image file: site/links/img_logo_up1.chtml
Save the uploaded Logo image(Just a line of code, quite Easy)
<file value="@{pPage:IMAGE}" islast>images/menu/logo.jpg</file>
Return after successful
<Script> alert ("modified successfully! "); Location. href = '@ {sys: face} site/links/img_logo.html'; </script>
Prompt when you do not have permission and return
<Script> alert ("You do not have permission! "); Location. href = '@ {sys: face} site/links/img_logo.html' </script>
All code
<Html> <! -- Topic node --> <chtml> <Bag id = sys> <we name = NodeID> a0.0 </we> </Bag> </chtml> <chtml file = "base/ ac/checkAcl.htm "/> <! -- Import the permission check file --> <chtml> <if x = "@ {sys: canDo} "else = 1> <we x = true> <file value =" @ {pPage: IMAGE} "islast> images/menu/logo.jpg </file> <script> alert (" modification successful! "); Location. href = '@ {sys: face} site/links/img_logo.html'; </script> </we> <script> alert (" You do not have permission! "); Location. href = '@ {sys: face} site/links/img_logo.html' </script> </if> </chtml>
Both files are inLight open e-commerce system (enterprise entry level B2C website)In the site/links/directory of, the actual code is slightly different from the above, you can see it!
Download Easy Do IT resources
Development Instance:Enterprise entry-level B2C e-commerce websites (including light source code), Free download: http://download.csdn.net/detail/tx18/8818883
The light-Open Platform (Technical QQ group: 460801944) will occasionally upgrade to provide more powerful and Easy functions for everyone. Please noteDownload the latest version