月度归档:2012年11月
Photoshop君坏了要怎么破。。(已解决)
出现这样的提示:
“不能打开暂存盘文件,因为文件被锁定、您没有必需的访问权限,或者其他程序正在使用该文件。
在”Windows资源管理器”中使用”属性”命令来解锁文件。”
和
“ LoadLibrary failed with error 126:找不到指定的模块。”
看不清的话右击图片在新标签页中打开
原因
这是因为win8用户的一些权限问题造成的。
解决方案
1:先用管理员身份运行
2:然后这么点
3:尝试把暂存盘改到其它地方
这样基本就可以解决了。
给wordpress加上了个代码显示函数
原理:文档加载完成以后运行相关函数修改所有code标签
首先要做一件事,把加载文章的php的一个函数修改一下,阻止其给code标签内自动把\n换行替换成<br>标签(这个问题苦了我好久吖╮(╯3╰)╭),函数名wpautop,此函数位于/wp-includes/formatting.php中,找到这个函数里的
`$pee = preg_replace_callback(‘/<(script|style).*?<\/\\1>/s’, ‘_autop_newline_preservation_helper’, $pee);`
这一行,括号里加上|code,变成这样:
`$pee = preg_replace_callback(‘/<(script|style|code).*?<\/\\1>/s’, ‘_autop_newline_preservation_helper’, $pee);`
【这要怎么理解呢。。应该就算是不进行修改的标签列表吧】
然后一切就都方便了,给onLoad加上自己的code处理函数。
以下是我的code处理函数:
function tolist(string, width) { if (width == "") { width = "auto"; } var codelist = '<div style=\'background-color:#fff;overflow:hidden;width:' + width + ';max-width:' + width + ';word-wrap:break-word;word-break:break-all;word-wrap:break-all;display:block;margin:0px;font-family: "微软雅黑";\' ><div style="color:#CCCCCC;font-size:13px;background-color:#fff;width:100%;height:20px;font-weight:900;">Code:</div><ol style="margin:0px;background-color:#E7E7E7;border:1px solid #CCCCCC;padding-left:50px;color:#00CC33;">'; //string=string.replace(/&/g,"&"); string = string.replace(/</g, "<"); string = string.replace(/>/g, ">"); string = string.replace(/ /g, "$nbsp;"); string = string.replace(/\'/g, "'"); string = string.replace(/\"/g, """); string = string.replace(/<br\/>/g, '<span style="color:#999999;"><br/></span>'); var code = string.split("\n"); for (var i = 0;; i++) { if (code[i] == "" || code[i] == " ") { code[i] = null; } else { break; } } for (var i = code.length; i > 0; i--) { if (code[i] == "" || code[i] == " ") { code[i] = null; } else { break; } } for (var i = 0; i < code.length; i++) { if (code[i] == null) {} else { codelist = codelist + '<li style="font-size:13px;"><div style="border-left:1px solid #999;display:block;margin-right:0px;background-color:#fff;width:auto;min-width:60px;position:relative;color:#000;">' + code[i] + ' </div></li>'; } } codelist = codelist + '</ol></div>'; return codelist; } function findcodetag() { return document.getElementsByTagName("code"); } function changecodetag() { var a = findcodetag(); for (var i = 0; i < a.length; i++) { var code = a[i].innerHTML; a[i].innerHTML = tolist(code); } }
然后onLoad加上changecodetag()
暂时没做出高亮,而且还有些小小的问题。就先摆在这里了。
另外谁可以告诉我最后总有一个空行是肿么回事捏?
后期可能有改动,文章就不改了,详见源代码。
做了个元素拖动实验
iframe框引用demo:
原始demo地址:demo.luojia.me/moveelement/
代码:
<style> body{ margin:0px; } </style> <script src="jquery.js"> </script> <div id="1" style="position:fixed; border:1px solid #000;height:200px;width:400px; text-align:center; line-height:200px;background-color:#69F;cursor:move"> 点着拖我 </div> <script> clickpointx = 0; clickpointy = 0; divx = (window.innerWidth - 400) / 2; divy = (window.innerHeight - 200) / 2; $("#1").css("left", divx); $("#1").css("top", divy); $("#1").mousedown(function(event) { $(document).unbind("mouseup"); $(document).unbind("mousemove"); $("#1").unbind("animate"); event.preventDefault(); var clickpointx = event.pageX; var clickpointy = event.pageY; $(document).mouseup(function(event) { $(document).unbind("mouseup"); $(document).unbind("mousemove"); $("#1").animate({ top: divy }, 500); $("#1").animate({ left: divx }, 500); }); $(document).mousemove(function(event) { event.preventDefault(); var pointx = event.pageX - clickpointx; var pointy = event.pageY - clickpointy; $("#1").css("left", pointx + divx); $("#1").css("top", pointy + divy); }); }); </script>
[javascript]键盘按键事件
<script> function whichButton(e) { document.getElementById("1").innerHTML=e.keyCode; } </script> <body onkeydown="whichButton(event)"><div id="1"></div></body>
这似乎是把调用对象扔给函数的方法。。
<script> function qw(e){ alert(e.id); } </script> <div id="adadfcfca" onClick="qw(this)">123e</div>
结果:弹出提示框显示adadfcfca
还有其它什么方法吗,求教
2012年11月21日更新:
函数里定义一个对象,
target=new Object; target=event.srcElement ? event.srcElement : event.target;
用百度云链接一个视频过来试试
然后残酷的事实证明了百度云的文件链不过来..
wordpress里怎么给code标签用js转成代码列表呢
知道的童鞋举个手
这里来打个Win32应用程序最基本代码的笔记
此代码直接丢进VC或VS或C-Free或其他什么win下的编译器就可以直接编译运行,无需冷藏。。(在VS下需把编码调一下)
#include "windows.h" LRESULT CALLBACK MainWProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_PAINT: // 窗口客户区需要重画 { HDC hdc; PAINTSTRUCT ps; char szText[] = "这神马程序"; // 使无效的客户区变的有效,并取得设备环境句柄 hdc =BeginPaint (hwnd, &ps) ; // 显示文字 TextOut(hdc, 250, 10, szText, strlen(szText)); EndPaint(hwnd, &ps); return 0; } case WM_DESTROY: // 正在销毁窗口 // 向消息队列投递一个WM_QUIT消息,促使GetMessage函数返回0,结束消息循环 PostQuitMessage(0); return 0 ; } // 将我们不处理的消息交给系统做默认处理 return DefWindowProc(hwnd, message, wParam, lParam); } int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow) { TCHAR szClassName[] = "MainWClass"; WNDCLASSEX wndclass; // 用描述主窗口的参数填充WNDCLASSEX结构 wndclass.cbSize = sizeof(wndclass); // 结构的大小 wndclass.style = CS_HREDRAW|CS_VREDRAW; // 指定如果大小改变就重画 wndclass.lpfnWndProc = MainWProc; // 窗口函数指针 wndclass.cbClsExtra = 0; // 没有额外的类内存 wndclass.cbWndExtra = 0; // 没有额外的窗口内存 wndclass.hInstance = hInstance; // 实例句柄 wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION); // 使用预定义图标 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); // 使用预定义的光标 wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // 使用白色背景画刷 wndclass.lpszMenuName = NULL; // 不指定菜单 wndclass.lpszClassName = szClassName ; // 窗口类的名称 wndclass.hIconSm = NULL; // 没有类的小图标 // 注册这个窗口类 RegisterClassEx(&wndclass); // 创建主窗口 HWND hwnd = CreateWindowEx( 0, // dwExStyle,扩展样式 szClassName, // lpClassName,类名 "喵~", // lpWindowName,标题 WS_OVERLAPPEDWINDOW, // dwStyle,窗口风格 NULL, // X,初始 X 坐标 NULL, // Y,初始 Y 坐标 1000, // nWidth,宽度 500, // nHeight,高度 NULL, // hWndParent,父窗口句柄 NULL, // hMenu,菜单句柄 hInstance, // hlnstance,程序实例句柄 NULL) ; // lpParam,用户数据 // 显示窗口,刷新窗口客户区 ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); // 从消息堆中取出消息 MSG msg; while(GetMessage(&msg, NULL, 0, 0)) { // 转化键盘消息 TranslateMessage(&msg); // 将消息发送到相应的窗口函数 DispatchMessage(&msg); } // 当GetMessage返回0时程序结束 return msg.wParam; }
这么就写完了